import os
import pandas as pd

# 工作站添加功能测试用例数据（包含执行结果）
data = {
    "用例编号": ["WS-ADD-001", "WS-ADD-002", "WS-ADD-003", "WS-ADD-004", "WS-ADD-005"],
    "测试类型": ["正向测试", "正向测试", "反向测试", "反向测试", "反向测试"],
    "标签": ["装配工作站-A", "测试工作站-B", "", "无效类型工作站", "负数测试工作站"],
    "类型": ["2", "2", "2", "1", "2"],
    "需要的操作人员数量": ["5", "1", "5", "5", "-5"],
    "Estimated operator THM": ["800", "1", "800", "800", "800"],
    "Estimated machine THM": ["3000", "1", "3000", "3000", "3000"],
    "状态": ["3", "3", "3", "3", "3"],
    "用户群组": ["2", "1", "2", "2", "2"],
    "预期结果": [
        "工作站添加成功，显示成功提示",
        "工作站添加成功，显示成功提示",
        "提示'标签不能为空'，工作站未创建",
        "提示'请选择有效类型'，工作站未创建",
        "提示'操作人员数量必须大于0'，工作站未创建"
    ],
    "实际结果": [
        "工作站添加成功，显示成功提示",
        "工作站添加成功，显示成功提示",
        "提示'标签不能为空'，工作站未创建",
        "工作站添加成功，与预期不一致",
        "工作站添加成功，与预期不一致"
    ],
    "状态": ["PASS", "PASS", "PASS", "FAIL", "FAIL"]
}

# 创建DataFrame
df = pd.DataFrame(data)

# 定义保存路径
folder = "D:\\pycharm\\PM_test\\Excel"
if not os.path.exists(folder):
    os.makedirs(folder)

# 保存为Excel文件
file_path = os.path.join(folder, "workstation_add_test_matrix.xlsx")
df.to_excel(file_path, index=False, sheet_name="工作站添加功能测试矩阵")

print(f"测试用例表已保存至：{file_path}")